package com.winhxd.b2c.order.api;

import com.winhxd.b2c.common.domain.ResponseResult;
import com.winhxd.b2c.common.domain.common.ApiCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderDictCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderSalesSummaryCondition;
import com.winhxd.b2c.common.domain.order.model.OrderDictInfo;
import com.winhxd.b2c.common.domain.order.vo.Order4meSummaryVO;
import com.winhxd.b2c.common.domain.order.vo.OrderDictInfoVO;
import com.winhxd.b2c.common.util.JsonUtil;
import com.winhxd.b2c.order.service.OrderDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wangxiaoshun
 * @date 2019/1/11 15:47
 * @Description 订单字典
 */
@RestController
@Api(tags = "ApiDict")
@RequestMapping(value = "/api-order/order")
public class ApiOrderDictController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApiOrderDictController.class);

    @Autowired
    OrderDictService orderDictService;

    @ApiOperation(value = "订单字典列表",  notes = "订单字典列表")
    @RequestMapping(value = "/4004/v1/getOrderCancelReason", method = RequestMethod.POST)
    ResponseResult<List<OrderDictInfoVO>> getOrderCancelReason(@RequestBody OrderDictCondition condition) {
        String logTitle = "/api-order/order/4004/v1/getOrderCancelReason-订单取消原因列表";
        LOGGER.info("--开始--{}", logTitle);
        ResponseResult<List<OrderDictInfoVO>> result = new ResponseResult<>();

        List<OrderDictInfoVO> orderDictInfoList = orderDictService.selectOrderDictByType(condition.getType());
        result.setData(orderDictInfoList);

        LOGGER.info("{}=--结束 result={}", logTitle, result);
        return result;
    }

}
